[general]
ui = ttyui
accounts = Gmail
pythonfile = ~/bin/getnetrc

[Account Gmail]
localrepository = Gmail-Local
remoterepository = Gmail-Remote
postsynchook = notmuch new

[Repository Gmail-Local]
type = Maildir
localfolders = ~/Mail/Gmail
nametrans = lambda folder: {'archive': '[Gmail]/All Mail',
                            'drafts': '[Gmail]/Drafts',
                            'important': '[Gmail]/Important',
                            'sent': '[Gmail]/Sent Mail',
                            'spam': '[Gmail]/Spam',
                            'starred': '[Gmail]/Starred',
                            'trash': '[Gmail]/Trash',
                           }.get(folder, folder)

[Repository Gmail-Remote]
type = Gmail
remoteusereval = get_login("offlineimap")
remotepasseval = get_password("offlineimap")
realdelete = no
maxconnections = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
# https://bbs.archlinux.org/viewtopic.php?pid=1588425#p1588425
auth_mechanisms = LOGIN

# Translate to something reasonable on disk
# Fuck yeah it's python.
nametrans = lambda folder: {'[Gmail]/All Mail': 'archive',
                            '[Gmail]/Drafts': 'drafts',
                            '[Gmail]/Important': 'important',
                            '[Gmail]/Sent Mail': 'sent',
                            '[Gmail]/Spam': 'spam',
                            '[Gmail]/Starred': 'starred',
                            '[Gmail]/Trash': 'trash',
                           }.get(folder, folder)

# Only sync folders that return True from lamda
# Fuck yeah it's python.
folderfilter = lambda folder: folder in ['[Gmail]/All Mail',
                                         '[Gmail]/Drafts',
                                         '[Gmail]/Important',
                                         '[Gmail]/Sent Mail',
                                         '[Gmail]/Spam',
                                         '[Gmail]/Starred',
                                         '[Gmail]/Trash',
                                         'ML/wmfall',
                                         'ML/wikitech-l',
                                         'ML/mediawiki-l',
                                         'ML/ops',
                                         'ML/github',
                                         'ML/debian-devel',
                                         'ML/debian-security',
                                         'ML/debian-user',
                                         'ML/debian-bugs',
                                         'ML/coreboot',
                                         'ML/unicode',
                                         'CR',
                                         'CI',
                                         'pipelinebot',
                                         'auto',
                                         'task',
                                         'INBOX',
                                        ]
